import 'package:flutter/material.dart';
import 'package:flutter_framework/translation/export_trans.dart';
import 'package:get/get.dart';

class Language extends StatefulWidget {
  const Language({super.key});

  @override
  LanguageState createState() => LanguageState();
}

class LanguageState extends State<Language> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('多语言测试'),
      ),
      body: Center(
        child: Column(
          children: [
            Text(HomeTransData.english.trArgs(["100","90"])),
            Text(LoginTransData.account.tr),
            Text(LoginTransData.login_btn.tr),
            TextButton(
              onPressed: () {
                String? language = Get.locale?.languageCode;
                print('当前语言环境 $language');
                Get.updateLocale(language=='en'? const Locale('zh','CN'): const Locale('en','US'));

              },
              child: const Text('语言切换'),
            )
          ],
        ),
      ),
    );
  }
}
